package exceptions;

import util.resources.ResourceManager;

/**
 * A project-specific exception.
 */
@SuppressWarnings("serial")
public class SLogoException extends RuntimeException
{
    /**
     * Gets an exception string by key from a resource bundle.
     */
    private static String getExceptionText(String key)
    {
        ResourceManager rm = ResourceManager.getInstance();
        rm.addResourcesFromFile("error");

        return rm.getString(key);
    }

    /**
     * Construct an exception from a specific error message key.
     */
    public SLogoException(String key)
    {
        super(getExceptionText(key));
    }

    /**
     * Construct a formatted exception from a specific error message key.
     */
    public SLogoException(String key, Object... args)
    {
        super(String.format(getExceptionText(key), args));
    }

}
